#
SUBDIRS = test-files

test_date_converting_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-date-converting.cpp

test_dom_converters1_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-dom-converters1.cpp

test_kvp_frames_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-kvp-frames.cpp

test_load_backend_SOURCES = \
test-load-backend.cpp
test_load_xml2_SOURCES = \
test-load-xml2.cpp
test_save_in_lang_SOURCES = \
test-save-in-lang.cpp

# the xml backend is now a GModule - this test does
# not load it as a module and cannot link to it
# and remain portable.

test_load_example_account_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-example-account.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-load-example-account.cpp

test_string_converters_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-string-converters.cpp

test_xml_account_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-xml-account.cpp

test_xml_commodity_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-xml-commodity.cpp

test_xml_pricedb_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-xml-pricedb.cpp

test_xml_transaction_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-xml-transaction.cpp

test_xml2_is_file_SOURCES = \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
  test-xml2-is-file.cpp

TESTS = \
  test-date-converting \
  test-dom-converters1 \
  test-kvp-frames \
  test-load-example-account \
  test-load-backend \
  test-load-xml2 \
  test-real-data.sh \
  test-string-converters \
  test-xml-account \
  test-xml-commodity \
  test-xml-pricedb \
  test-xml-transaction \
  test-xml2-is-file

GNC_TEST_DEPS = \
  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module \
  --gnc-module-dir ${top_builddir}/libgnucash/engine \
  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
  --guile-load-dir ${top_builddir}/libgnucash/engine \
  --library-dir    ${top_builddir}/libgnucash/core-utils \
  --library-dir    ${top_builddir}/libgnucash/gnc-module \
  --library-dir    ${top_builddir}/libgnucash/engine \
  --library-dir    ${top_builddir}/libgnucash/backend/sql  \
  --library-dir    ${top_builddir}/libgnucash/backend/xml

TESTS_ENVIRONMENT = \
  GUILE_WARN_DEPRECATED=no \
  GNC_ACCOUNT_PATH=${top_srcdir}/data/accounts/C \
  GNC_TEST_FILES=test-files/xml2 \
  SRCDIR=${srcdir} \
  GNC_BUILDDIR="${abs_top_builddir}" \
  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})

check_LTLIBRARIES = libgnc-test-file-stuff.la

libgnc_test_file_stuff_la_SOURCES = test-file-stuff.cpp
libgnc_test_file_stuff_la_LIBADD = \
  ${top_builddir}/libgnucash/engine/libgncmod-engine.la

check_PROGRAMS = \
  test-date-converting \
  test-dom-converters1 \
  test-kvp-frames \
  test-load-backend \
  test-load-example-account \
  test-load-xml2 \
  test-save-in-lang \
  test-string-converters \
  test-xml-account \
  test-xml-commodity \
  test-xml-pricedb \
  test-xml-transaction \
  test-xml2-is-file

noinst_HEADERS = test-file-stuff.h

LDADD = \
        ${top_builddir}/common/test-core/libtest-core.la \
        ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
        ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
        ${top_builddir}/libgnucash/engine/test-core/libgncmod-test-engine.la \
        ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
        ./libgnc-test-file-stuff.la \
        ${LIBXML2_LIBS} \
        ${ZLIB_LIBS} \
        ${top_builddir}/borrowed/libc/libc-missing.la

AM_CPPFLAGS = \
  -I${top_srcdir}/borrowed/libc \
  -I${top_srcdir}/common \
  -I${top_srcdir}/libgnucash/core-utils \
  -I${top_srcdir}/libgnucash/gnc-module \
  -I${top_srcdir}/common/test-core \
  -I${top_srcdir}/libgnucash/engine \
  -I${top_srcdir}/libgnucash/engine/test-core \
  -I${top_srcdir}/libgnucash/backend/xml \
  -DU_SHOW_CPLUSPLUS_API=0 \
  ${LIBXML2_CFLAGS} \
  ${GLIB_CFLAGS} \
  ${GUILE_CFLAGS} \
  ${BOOST_CPPFLAGS}

EXTRA_DIST = \
  grab-types.pl \
  test-dom-parser1.cpp \
  test-real-data.sh \
  test-xml2-is-file.cpp \
  CMakeLists.txt

AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.xml\"
